<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fnx" uri="http://java.sun.com/jsp/jstl/functionsx" %>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="f" uri="http://www.sctv.com/tags/form" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="/WEB-INF/views/head.jsp"/>
    <script>
      $(function () {
        $("input.minicolors").minicolors();
        $("#validForm").validate({
          submitHandler: function (form) {
            if (!$("#linkCheck").is(":checked")) {
              $("#link").val("");
            }
            form.submit();
          }
        });
        $("input[name='title']").focus();
      });
      function imgCrop(name) {
        if ($("#" + name).val() == "") {
          alert("<s:message code='noImageToCrop'/>");
          return;
        }
        Cms.imgCrop("../../commons/img_area_select.do", name);
      }
      function confirmDelete() {
        return confirm("<s:message code='confirmDelete'/>");
      }
      //选择关联内容
      function chooseInfo() {
        var connInfoid = $("#connInfoid").val();
        var title = $("#title").val();
        location.href = 'focuslist.do?returnUrl=core/publish_center/node_choose_info&targetNodeId=${queryNodeId}';
//  location.href='/cmscp/core/flash_big/chooseinfolist.do?tab=profile&returnUrl=core/flash_big_news/node_choose_info&connInfoid='+connInfoid+'&title='+title;
      }
    </script>
</head>
<body class="skin-blue content-body">
<jsp:include page="/WEB-INF/views/commons/show_message.jsp"/>
<c:set var="usernameExist"><s:message code="info.management"/></c:set>
<div class="content-header">
    <h1><s:message code="info.management"/> - <s:message code="${oprt=='edit' ? 'edit' : 'create'}"/><c:if
            test="${oprt=='edit'}">
        <small>(<s:message code="info.status"/>: <s:message code="info.status.${bean.status}"/>, ID:${bean.id})</small>
    </c:if></h1>
</div>
<div class="content">
    <div class="box box-primary">
        <form class="form-horizontal" id="validForm" action="focusinfosave.do" method="post" novalidate="novalidate">
            <input type="hidden" name="queryNodeId" value="${queryNodeId}">
            <input type="hidden" name="queryNodeType" value="0">
            <input type="hidden" name="queryInfoPermType">
            <input type="hidden" id="queryStatus" name="queryStatus">
            <input type="hidden" name="oid">
            <input type="hidden" name="position">
            <input type="hidden" id="redirect" name="redirect" value="edit">
            <div class="box-header with-border">
                <div class="btn-toolbar">
                    <div class="btn-group">
                        <button class="btn btn-default" type="button"
                                onclick="location.href='infolist.do?queryNodeId=146&amp;queryNodeType=0&amp;queryInfoPermType=&amp;queryStatus=&amp;';">
                            返回
                        </button>
                    </div>
                </div>
            </div>
            <div class="box-body">
                <input type="hidden" id="nodeId" name="nodeId" value="${queryNodeId}">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">新闻类型</label>
                            <div class="col-sm-6">
                                <select class="form-control" name="newsType">
                                    <f:option value="1" selected="${type}">图文新闻</f:option>
                                    <f:option value="2" selected="${type}">音频新闻</f:option>
                                    <f:option value="3" selected="${type}">视频新闻</f:option>
                                    <f:option value="4" selected="${type}">专题</f:option>
                                    <f:option value="5" selected="${type}">直播新闻</f:option>
                                    <f:option value="6" selected="${type}">第三方链接</f:option>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="row">

                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">关联内容</label>
                                <div class="col-sm-6">
                                    <button class="btn btn-primary" onclick="chooseInfo()" type="button">选择关联内容</button>
                                    <input type="hidden" id="refInfoid"  name="refInfoId" value="${refInfo.id}">
                                </div>
                            </div>
                        </div>


                        <c:if test="${type eq '1'}">

                        </c:if>
                        <c:if test="${type eq '2'}">

                        </c:if>
                        <c:if test="${type eq '3'}">

                        </c:if>

                    </div>
                    <div class="row">

                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><em class="required">*</em>新闻标题</label>
                                <div class="col-sm-8">

                                    <div class="input-group">
                                        <input type="text" name="title" maxlength="150" class="required form-control" value="${refInfo.detail.title}">
                                        <span class="input-group-addon">
							    	<label style="margin-bottom:0;font-weight:normal;"><input id="linkCheck"
                                                                                              type="checkbox"
                                                                                              onclick="$('#linkDiv').toggle(this.checked);"
                                                                                              style="margin-right:2px;">转向链接</label>
							    </span>
                                    </div>
                                    <div class="input-group" id="linkDiv" style="margin-top:2px;display:none;">
                                        <input type="text" id="link" name="link" maxlength="255" class="form-control">
                                        <span class="input-group-addon">
						    		<span class="in-prompt"
                                          title="外部转向链接格式为http://www.google.com，内部转向链接格式为/info/1.jspx"></span>
						    	</span>
                                    </div>

                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="row">

                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">封面图片</label>
                                <div class="col-sm-10">
                                    <tags:image_upload name="smallImage" value="${refInfo.detail.smallImage}"  />
                                </div>
                            </div>
                        </div>

                    </div>

                    <%--<div class="row">--%>

                        <%--<div class="col-sm-12">--%>
                            <%--<div class="form-group">--%>
                                <%--<label class="col-sm-2 control-label">url</label>--%>
                                <%--<div class="col-sm-8">--%>
                                    <%--<input type="text" name="linkAddress"  class="form-control">--%>
                                <%--</div>--%>
                            <%--</div>--%>
                        <%--</div>--%>
                <%--</div>--%>
                <div class="box-footer">
                    <button class="btn btn-primary" type="submit">保存</button>
                </div>

            </div>
        </form>
    </div>


</div>

</body>
</html>